// 计算圆柱体体积第2版

// 计算圆柱体的体积

#include <iostream>
using namespace std;

#include <math.h>

void GetCylinderDimensions(float* radius, float* height);

float CalcCylinderVolume(float radius, float height);

int main() {
    float radius;
    float height;

    // 相当于函数返回了两个值
    GetCylinderDimensions(&radius, &height);

    float volume = CalcCylinderVolume(radius, height);
    cout << "圆柱体的体积为: " << volume << "\n";
}

void GetCylinderDimensions(float* radius, float* height) {
    cout << "请输入圆柱体的半径和高度: ";
    cin >> *radius >> *height;
}

float CalcCylinderVolume(float radius, float height) {
    return (float)M_PI * radius * radius * height;
}
